package com.feicheng.service.a;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.feicheng.common.constant.Constant;
import com.feicheng.persistence.entity.Ayyjlitem;
import com.feicheng.persistence.service.IAyyjlitemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDate;
import java.time.LocalDateTime;

@Service
public class FYyService {

    @Autowired
    IAyyjlitemService ayyjlitemService;

    public void hxYyjl() {
        LocalDateTime now = LocalDateTime.now();
        UpdateWrapper<Ayyjlitem> ytqw = new UpdateWrapper<>();
        ytqw.eq("rq", now.format(Constant.yyyyMMdd));
        ytqw.le("st", now.format(Constant.HHmmss));
        ytqw.ge("st", now.minusMinutes(5L).format(Constant.HHmmss));
        ytqw.eq("statu", "U");
        ytqw.set("statu", "R");
        ayyjlitemService.update(ytqw);

        ytqw.clear();
        ytqw.eq("rq", now.format(Constant.yyyyMMdd));
        ytqw.le("et", now.format(Constant.HHmmss));
        ytqw.eq("statu", "R");
        ytqw.set("statu", "P");
        ayyjlitemService.update(ytqw);
    }
}
